﻿using System;
using System.Collections.Generic;

namespace ClassLibrary
{
    public class Marker
    {
        private string _title = Parameters.Values.RM.GetString("Marker_DefaultName");

        public string title
        {
            get { return _title; }
            set { _title = value; }
        }
        public Marker self
        {
            get { return this; }
        }
        public List<Event> events = new List<Event>();
        public List<string> categories = new List<string>();
        /*public string localPath_Img_Small;
        public string localPath_Img_Medium;
        public string serverPath_Img_Small;
        public string serverPath_Img_Medium;*/
        public string Img_Medium;
        public string Img_Small;

        public float lat = Parameters.Values.default_lat;
        public float lng = Parameters.Values.default_lng;

        public decimal MediumWidth, MediumHeight, SmallWidth, SmallHeight;

        public bool published = false;

        public Event getEventByID(Guid ID)
        {
            Event res = null;
            foreach (Event e in events)
            {
                if (e.ID == ID)
                {
                    res = e;
                    break;
                }
            }
            return res;
        }
        public void removeEventByID(Guid ID)
        {
            Event eToDel = getEventByID(ID);
            if (null != eToDel)
                events.Remove(eToDel);
        }
        public Marker _Clone()
        {
            Marker res = new Marker();
            res.title = title;

            //Copie de categories
            res.categories = new List<string>(categories);

            //Copie de evenements
            res.events = new List<Event>();
            foreach (Event e in events)
                res.events.Add(e._Clone());

            res.Img_Small = Img_Small;
            res.Img_Medium = Img_Medium;
            res.Img_Small = Img_Small;
            res.Img_Medium = Img_Medium;
            res.lat = lat;
            res.lng = lng;

            res.MediumHeight = MediumHeight;
            res.MediumWidth = MediumWidth;
            res.SmallHeight = SmallHeight;
            res.SmallWidth = SmallWidth;

            return res;
        }

    }
}
